Link to this headingDNS
https://jan.wildeboer.net/2025/08/My-DNS-Part-1/ deploying your own DNS
https://technitium.com/dns/ new DNS server
Link to this headingDNSSEC
Can only check if a DNS record has been changed.
Link to this headingAlgorithms
| Number | Mnemonics | DNSSEC Signing | DNSSEC Validation |
|---|---|---|---|
| 1 | RSAMD5 | MUST NOT | MUST NOT |
| 3 | DSA | MUST NOT | MUST NOT |
| 5 | RSASHA1 | NOT RECOMMENDED | MUST |
| 6 | DSA-NSEC3-SHA1 | MUST NOT | MUST NOT |
| 7 | RSASHA1-NSEC3-SHA1 | NOT RECOMMENDED | MUST |
| 8 | RSASHA256 | MUST | MUST |
| 10 | RSASHA512 | NOT RECOMMENDED | MUST |
| 12 | ECC-GOST | MUST NOT | MAY |
| 13 | ECDSAP256SHA256 | MUST | MUST |
| 14 | ECDSAP384SHA384 | MAY | RECOMMENDED |
| 15 | ED25519 | RECOMMENDED | RECOMMENDED |
| 16 | ED448 | MAY | RECOMMENDED |
Link to this headingKeys
Get Top Level DNS Key:
>>> dig
; <<>> DiG
; ()
;;
;;
;;
The DNSKEY Response contains 2 DNSKEY Keys. These are differentiated by the flags.
Key Signing Key (Flag 257): The key that is used to sign the Zone Signing Key with the signature information in the RRSIG info.
Zone Signing Key (Flag 256): The key that is used to sign DNS records and subdomains with RRSIG data.
DNSSec Record:
>>> dig
; <<>> DiG
;;
;;
;;
Link to this headingImplementation
DNSSec Manual Verify:
"""Convert a DNSKEY record to a public key object, supporting various algorithms."""
#print(f"DNSKey: {dnskey.flags} {dnskey.protocol} {dnskey.algorithm} {dnskey.key}")
#flags, protocol, algorithm, key = [dnskey.flags, dnskey.protocol, dnskey.algorithm, dnskey.key]
return
"""Resolve a hostname to an IP address."""
= # Query for IPv4
return
# Get DNSKey from Name Servers
=
=
# Check if valid response
return
# Check if key exists
=
return
# Check if the DNSKEY record is signed, RRSET validation
=
# Get DNSKeys
=
= None
# Get keys from response
=
=
# Zone Signing Key
=
# Key Signing Key
# Validate RRSIG
=
#print(f"SignData: {data.hex()}")
#print(f"Public Key: {signing_key.key.public_bytes(encoding=serialization.Encoding.PEM,format=serialization.PublicFormat.SubjectPublicKeyInfo)}")
#Get the correct signing key
# Get the correct signing key
break
return ,
"""Validate DNSSEC for the given domain and record type."""
# Fetch the specified record_type from the nameserver
=
=
# Get the answer
=
=
#Get and Verify DNSKEYs
# Get and verify DNSKEYs
# Validate record_type RRSIG with the zone_signing_key
=
#print(f"Signature: {rrsig.signature.hex()}")
#print(f"SignData: {data.hex()}")
#print(f"Public Key: {zone_signing_key.key.public_bytes(encoding=serialization.Encoding.PEM,format=serialization.PublicFormat.SubjectPublicKeyInfo)}")
return
return
"""Validate DNSSEC for the given domain and record type."""
# Fetch the specified record_type from the nameserver
=
=
# Get the answer
=
=
# Get and verify DNSKEYs
, =
# Validate record_type RRSIG with the zone_signing_key
=
#print(f"Signature: {rrsig.signature.hex()}")
#print(f"SignData: {data.hex()}")
#print(f"Public Key: {zone_signing_key.key.public_bytes(encoding=serialization.Encoding.PEM,format=serialization.PublicFormat.SubjectPublicKeyInfo)}")
return
return
# Update __main__ to include subdomain validation
=
=
=
=
= None
#Do a DNSSEC A Record Query for example.com
# Do a DNSSEC A Record Query for example.com
# Get Response for Query with RRsig
# Get DNSKeys for example.com
# Verify DNSKEY RRsig for example.com domain
# Verify A RRSig with example.com zone_signing_key DNSKey
#Do a DNSSEC DS Record Query for example.com
# Do a DNSSEC DS Record Query for example.com
# Get Response for Query with RRsig
# Get DNSKeys for .com
# Verify DNSKEY RRsig for .com domain
# Verify DS RRSig with .com zone_signing_key DNSKey
#Do a DNSSEC DS Record Query for .com
# Do a DNSSEC DS Record Query for .com
# Get Response for Query with RRsig
# Get DNSKeys for .
# Verify DNSKEY RRsig for . domain
# Verify DS RRSig with . zone_signing_key DNSKey